from db import db


class LoggerEvent(db.Model):
    __tablename__ = "logger_event"
    event_id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    time_stmp = db.Column(db.DateTime, nullable=False)
    format_msg = db.Column(db.Text, nullable=False)
    logger_name = db.Column(db.String(64), nullable=False)
    level = db.Column(db.String(32), nullable=False)
    thread_name = db.Column(db.String(64), nullable=False)
    refer_flag = db.Column(db.String(64))
    arg0 = db.Column(db.String(32))
    arg1 = db.Column(db.String(32))
    arg2 = db.Column(db.String(32))
    arg3 = db.Column(db.String(32))
    caller_file_name = db.Column(db.String(32))
    caller_clazz = db.Column(db.String(32))
    caller_method = db.Column(db.String(32))
    caller_line = db.Column(db.String(32))

    def __str__(self):
        return '<logger_event %d %s %s %s >' % self.event_id, self.time_stmp,\
               self.level, self.format_msg
    __repr__ = __str__


